package com.nt.train.dao;
import com.nt.train.entity.Department;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
 * 部门dao
 * @author hlf
 * @version 1.0
 * @date 2022/8/16 17:29
 */
@Repository
public class DepartmentDao {
    //模拟数据库中的数据

    private  static Map<Integer, Department> department = null;

    static {
        department = new HashMap<Integer,Department>(); //创建一个部门表
        department.put(101,new Department(101,"教学部"));
        department.put(102,new Department(102,"教研部"));
        department.put(103,new Department(103,"市场部"));
        department.put(104,new Department(104,"运营部"));
        department.put(105,new Department(105,"清洁部"));
    }

    //获得所有部门信息
    public Collection<Department> getDepartmentList(){
        return  department.values();

    }

    //通过id得到部门
    public  Department getDepartmentByid(Integer id){
        return  department.get(id);

    }

}